package cn.edu.scau.cmi.huxiantao.simpleFactory;

import java.net.URL;
import java.util.ResourceBundle;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ListView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

public class FXMLController implements Initializable{
	@FXML
	private ListView<String> listView;
	@FXML
	private ChoiceBox<String> choiceBox;
	@FXML
	private ImageView imageView;
	
	
	private ObservableList<String> list;
	
	@FXML
	private void onShowInsuInfo() {
		String[] types= {"BodyInjury","CarInjury","ManInjury","MultInjury"};
		int index=choiceBox.getSelectionModel().getSelectedIndex();
		String info=InsuranceFactory.getInstance(types[index]).getInfo();
		list.add(info);
	}
	
	@Override
	public void initialize(URL arg0, ResourceBundle arg1) {
		choiceBox.setItems(FXCollections.observableArrayList("身体受伤","汽车损坏","人员伤亡","多种事故"));
		choiceBox.setValue("身体受伤");
		list=FXCollections.observableArrayList();
		listView.setItems(list);
		imageView.setImage(new Image("/cn/edu/scau/cmi/huxiantao/pic/pic.jpg"));
		
	}
}
